package com.iceGame;

import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.MassData;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;

public class MovingPlatform extends MovingGameObject {

	public MovingPlatform(PhysicsWorld world, float x, float y, float width,
			float height) {
		super(world, x, y, width, height);
		
	}

	@Override
	protected void setBody(World world, float x, float y, float width,float height) {
		//create the shape	
		PolygonShape shape = new PolygonShape();
		shape.setAsBox(width/2, height/2);
		
		//create  FixtureDef	
		FixtureDef ShapeDef = new FixtureDef();
		ShapeDef.shape = shape;
		ShapeDef.filter.categoryBits=PhysicsWorld.CATEGORY_PLATFORM;
		ShapeDef.filter.maskBits=PhysicsWorld.MASK_PLATFORM;
		//create  BodyDef
		BodyDef bodydef = new BodyDef();
		bodydef.position.set(x,y);
		bodydef.type = BodyType.KinematicBody;
		
		// create Bod
		body = world.createBody(bodydef);		
		body.createFixture(ShapeDef);
		
		MassData data = new MassData();
		ShapeDef.friction = 0.9f;
		data.mass = 0;
		data.I = 0;
		body.setMassData(data);		
	}

	@Override
	public void update(float deltaTime){
		super.update(deltaTime);
	}
}
